# frozen_string_literal: true

class GqlResolver::VariableType::Search < GqlResolver::BaseQuery
  type [GqlTypes::Bz::VariableTypeType], null: true

  argument :name, String, required: false
  argument :status, GqlTypes::Enum::VariableTypeStatus, required: false

  def resolve(**params)
    VariableType
      .filter_name(params[:name])
      .filter_status(params[:status])
  rescue StandardError => e
    ErrorLogger.error(e)
    []
  end
end
